<template>
    <div>
        <el-input placeholder="会员昵称" v-model="searchName"></el-input>
        <el-date-picker
           v-model="searchTime"
           type="date"
           placeholder="寄售时间"
           format="yyyy - MM - dd"
           value-format="yyyy-MM-dd">
        </el-date-picker>
        <el-input placeholder="订单号" v-model="searchId"></el-input>
        <button class="sousuo" @click="getRecord"><i class="el-icon-search"></i></button>
        <el-table :data="jiluTable" border style="width: 100%">
            <el-table-column prop="uid" label="ID" width="55">
            </el-table-column>
            <el-table-column prop="name" label="用户信息">
                <template v-slot="scope">
                    <div class="head_url">
                        <img :src="scope.row.head_url" alt="">
                    </div>
                    <div class="info">
                        <div class="uid">UID:<span>{{ scope.row.uid }}</span></div>
                        <div class="nickname">{{ scope.row.name }}</div>
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="orderid" label="订单号">
            </el-table-column>
            <el-table-column label="寄售金额">
                <template v-slot="scope">
                    <el-button size="mini" type="warning" round>￥{{ format_money(scope.row.sale_money) }}</el-button>
                </template>
            </el-table-column>
            <el-table-column prop="sale_count" label="寄售数量">
            </el-table-column>
            <el-table-column prop="date" label="支付时间">
            </el-table-column>
            <el-table-column prop="address" label="操作">
                <template v-slot="scope">
                    <el-button size="mini" type="primary" @click="getDetail(scope.row.uuid)" round>寄售奖品详情
                    </el-button>
                    <el-dialog title="开奖奖品详情" :visible.sync="recordVisible">
                    <el-table :data="gridData">
                        <el-table-column property="date" label="赏品信息" width="150">
                            <template v-slot="scope">
                                <div class="display_url">
                                    <img :src="scope.row.display_url" alt="">
                                    {{ scope.row.name }}
                                </div>
                            </template>
                        </el-table-column>
                        <el-table-column property="name" label="赏品名称" width="200"></el-table-column>
                        <el-table-column property="address" label="回收价值">
                            <template v-slot="scope">
                                <el-button size="mini" type="warning" round>
                                    ￥{{ format_money(scope.row.recovery_price) }}
                                </el-button>
                            </template>
                        </el-table-column>
                        <el-table-column label="赏品数量">1</el-table-column>
                    </el-table>
                    </el-dialog>
                </template>
            </el-table-column>
             
        </el-table>
        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pagenum"
                 :page-sizes="[8, 10, 15]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper"
                 :total="total">
         </el-pagination>
    </div>
</template>

<script>
import { format_money } from "@/utils/format";
import record from '../../../api/jurisdiction'
export default {
    data() {
        return {
             dialogTableVisible: false,
                gridData: [],
            tilianVisible: false,
            recordVisible:false,
            searchName:null,
            searchId: null,
            searchTime:null,
            jiluTable: [],
            pagenum: 1,
            pagesize: 8,
            total: 0
        }
    },
    created() {
        this.getRecord()
    },
    methods: {
        getDetail(id) {
            this.recordVisible = true
            record.tilianDetail({
                order_refined_uuid:id
            }).then((res) => {
                this.gridData = res.data.data.list
                console.log(res)
            })
        },
        format_money,
        getRecord() {
            record.tilianJiLu({
                name: this.searchName,
                orderid: this.searchId,
                date:this.searchTime,
                page:this.pagenum,
                page_size:this.pagesize
            }).then((res) => {
                this.jiluTable = res.data.data.list
                this.total = res.data.data.sum_count
                console.log('提炼记录',res)
            })
        },
           handleSizeChange(val) {
            this.pagesize = val
            this.getRecord()
            console.log(`每页 ${val} 条`);
            },
            handleCurrentChange(val) {
                this.pagenum = val
                this.getRecord()
                console.log(`当前页: ${val}`);
            },
    },
}
</script>

<style lang="less" scoped>
.el-input {
    width: 250px;
    margin-right: 20px;
}

.sousuo {
    margin: 6px;
    width: 50px;
    height: 40px;
    background: #009688;
    border: 0;
    color: white;
    font-size: 20px;
    vertical-align: middle;
    text-align: center;
    line-height: 40px;
    border-radius: 4px;
    cursor: pointer;
}

.head_url {
    float: left;
    width: 50px;
    height: 50px;
}

.head_url img {
    width: 100%;
    height: 100%;
}

.info {
    float: left;
    width: 100px;
    height: 100%;
    margin-left: 10px;
}
.display_url img{
    width:60px;
    height: 60px;
    vertical-align: middle;
}
.el-pagination{
    text-align: center;
    margin-top: 10px;
}
.uid {
    color: red;
    font-size: 12px;
}</style>